#include "stdafx.h"
#include <XLabel.h>

XLabel::XLabel(XHash hash, XWindow* parentWindow)
{
	Hash = hash;
	ParentWindow = parentWindow;

	Text = new XTextPack(hash);
	Text->SetFont(ParentWindow->GetFont());
	Text->SetTextBox(XRectangle(40, 10, 200, 60));
	ParentWindow->RegisterControlsText(Text);
}

void XLabel::SetText(const char* text)
{
	Text->SetText(text);
}

void XLabel::SetText(int number)
{
	Text->SetText(number);
}

void XLabel::SetGeometry(XRectangle rect)
{
	Text->SetTextBox(rect);
}

XRectangle XLabel::GetGeometry()
{
	return Text->GetTextBox();
}

void XLabel::Update(XInputModule* input)
{
	Text->SetTranslation(XVector(ParentWindow->GetGeometry()->X, ParentWindow->GetGeometry()->Y));
}